home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / More Source / Libraries / VideoToolbox 95.04.18 / VideoToolboxSources / SetMouse.c < prev    next >
Text File  |  1994-10-18  |  2KB  |  55 lines

  1. /*
  2. SetMouse.c
  3.  
  4. Sets the mouse location to the given point, which is specified in the local
  5. coordinate system of the current port.
  6.  
  7. WARNING: In the Q & A Stack, Apple tells you how to do this, but warns that the
  8. technique uses undocumented low-memory locations that are considered unsupported
  9. and volatile and may change in future CPUs.
  10.  
  11. WARNING: This may not work as native code on the PowerPC. Then again, it might.
  12.  
  13. WARNING: According to a note from Apple, this may not work on some newer 680x0 Macs,
  14. e.g. the Centris. They've issued preliminary documentation of a Cursor Device Manager
  15. that eventually will support all Macs. See MoveMouse.c in VideoToolboxSources.
  16.  
  17. From "Code gadgets: Setting the mouse location", THINKin' CaP, 1(2):28-29, Fall 1990.
  18.  
  19. Copyright © 1991 SPLAsh Resources. All rights reserved. This source code is
  20. copyrighted, but free. This means that programmers may use the code and
  21. incorporate it into their own programs (commercial or otherwise) without payment
  22. of any fees. However, the source code itself may not be sold or distributed on
  23. electronic bulletin board services without written permission from SPLAsh
  24. Resources.
  25.  
  26. SPLAsh Resources
  27. 1678 Shattuck Ave #302
  28. Berkeley, CA  94709
  29. (415) 527-0122
  30.  
  31. HISTORY:
  32. 2/25/91 dgp added to VideoToolbox
  33. 8/24/91    dgp    Made compatible with THINK C 5.0.
  34. 5/28/94 dgp Eliminated use of SysEqu.h, for compatibility with Apple's Universal Headers.
  35. */
  36. #include "VideoToolbox.h"
  37.  
  38. volatile Point MTemp : 0x828;        /* Low memory globals */
  39. volatile Point RawMouse : 0x82C;
  40. volatile Byte CrsrNew : 0x8CE;
  41. volatile Byte CrsrCouple : 0x8CF;
  42.  
  43. void SetMouse(Point    where)
  44. {
  45.  
  46.     LocalToGlobal(&where);        /* Convert point to global coordinates    */
  47.     
  48.     /* Quoting from the Q & A Stack: "If you wish to place the cursor in an    */
  49.     /* absolute location on the screen, you must set RawMouse, and MTemp to    */
  50.     /* the same value, and set CrsrNew to the same value as CrsrCouple."    */
  51.         
  52.     MTemp=RawMouse=where;
  53.     CrsrNew=CrsrCouple;
  54. }
  55.